//
//  ThirdImaCell.m
//  cooba-iOS
//
//  Created by 郭四虎 on 16/8/25.
//  Copyright © 2016年 YouKu. All rights reserved.
//

#import "ThirdImaCell.h"

@implementation ThirdImaCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (IBAction)upClick:(UIButton *)sender {
    
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 30, 20)];
    font(label, 14);
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor redColor];
    label.center = sender.center;
    label.text = @"+1";
    
    [self.contentView addSubview:label];
    
    [UIView animateWithDuration:0.5 animations:^{
        label.alpha = 0;
        label.y -= 50;
    } completion:^(BOOL finished) {
        
        self.num.text = [NSString stringWithFormat:@"%ld",self.num.text.integerValue +1];
        [label removeFromSuperview];
    }];
}

- (void)showModel:(NewsModel *)model
{
    NSArray *arr = [model.img_url componentsSeparatedByString:@"#~@"];
    
    NSString *str;
    NSString *str1;
    NSString *str2;
    
    str = arr[0];
    str1 = arr[1];
    str2 = arr[2];
    
    
    
    [_ima1 sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"酷吧LOGO_meitu_1"]];
    [_ima2 sd_setImageWithURL:[NSURL URLWithString:str1] placeholderImage:[UIImage imageNamed:@"酷吧LOGO_meitu_1"]];
    [_ima3 sd_setImageWithURL:[NSURL URLWithString:str2] placeholderImage:[UIImage imageNamed:@"酷吧LOGO_meitu_1"]];
    
    
    if ([model.title rangeOfString:@"&quot;"].location !=NSNotFound) {
        
        NSString *str = [model.title stringByReplacingOccurrencesOfString:@"&quot;" withString:@"\""];
        _title.text = str;
    }else if([model.title rangeOfString:@"&ldquo;"].location !=NSNotFound){
        
        NSString *str = [model.title stringByReplacingOccurrencesOfString:@"&ldquo;" withString:@"“"];
        str = [str stringByReplacingOccurrencesOfString:@"&rdquo;" withString:@"”"];
        
        _title.text = str;
        
    }else{
        
        _title.text = model.title;
    }
    
    if (model.is_read) {
        _title.textColor = [UIColor lightGrayColor];
    }else{
        _title.textColor = [UIColor blackColor];
    }
    
    self.from.text = model.author?model.author:@"知行安徽";
    
    self.num.text = model.num;
        
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
